<template>
<div>

  <div class="container">
    <div class="row clearfix">
      <div class="col-md-12 column">

        <div class="jumbotron">
          <h1>
            单个分类
          </h1>
          <p>
            输入新闻内容分类
          </p>

        </div>
      </div>
    </div>
    <div class="row clearfix">
      <div class="col-md-4 column">
      </div>
      <div class="col-md-4 column">

        <!-- <form action='/news/upload' method='post' enctype='multipart/form-data'>
            <input type='file' name='file'>
            <button type='submit'>上传</button>
            <input type='text' name='text'/>
        </form> -->

          <div class="form-group">
            <div style="margin: 20px 0;"></div>
            <el-input
                type="textarea"
                placeholder="请输入内容"
                v-model="textarea"
                maxlength="1500"
                show-word-limit
            >
            </el-input>
          </div>
          <div class="checkbox">

          </div> <button class="btn btn-success" v-on:click="onSubmit">开始分类！</button>
          <el-input
              type="text"
              placeholder="请输入内容"
              v-model="text"
              maxlength="10"
              show-word-limit
              v-if="classon"
          >
          </el-input>

      </div>
      <div class="col-md-4 column">
      </div>
    </div>
  </div>

  <div class="row clearfix">
    <div class="col-md-12 column footer">
      <p style="text-align: center;">
        文文 ADN 港港 <strong>不写注释</strong> 编写
      </p>
    </div>
  </div>
</div>
</template>

<script>
export default {
  name: "Snews",
  data() {
    return {
      text: '',
      textarea: '',
      classon:false
    }
  },
  methods: {
    onSubmit() {
      let _this=this;
      _this.$ajax.post(baseUrl+"news/classifier",{
        context:_this.textarea
      }).then((response)=>{
          _this.text=response.data.tag;
          _this.classon=true;
      })
    }
  }
}
</script>

<style scoped>
.footer{
  background-color: #EEEEEE;
  height: 100px;
  line-height: 100px;

  margin-top: 100px;
}
</style>